package com.ktjy.pojo;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * 系统用户实体类
 *
 * @author LILIBO
 * @since 2025-10-31
 */
public class SysUser implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private long id;

    /**
     * 账号
     */
    private String account;

    /**
     * 真实姓名
     */
    private String realName;

    /**
     * 密码
     */
    private String password;

    /**
     * 性别（1:女、 2:男）
     */
    private int sex;

    /**
     * 出生日期（年-月-日）
     */
    private String birthday;

    /**
     * 手机号码
     */
    private String phone;

    /**
     * 用户地址
     */
    private String address;

    /**
     * 用户角色id
     */
    private long roleId;

    /**
     * 创建人
     */
    private long createdUserId;

    /**
     * 创建时间
     */
    private String createdTime;

    /**
     * 修改人
     */
    private long updatedUserId;

    /**
     * 修改时间
     */
    private String updatedTime;

    /**
     * 用户角色名称（关联到角色表）
     */
    private String roleName;

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    // 关联的角色对象（一对一）
    private SysRole sysRole;

    /**
     * 获取关联的角色对象
     */
    public SysRole getSysRole() {
        return sysRole;
    }

    /**
     * 设置关联的角色对象
     */
    public void setSysRole(SysRole sysRole) {
        this.sysRole = sysRole;
    }

    // 关联的地址对象（一对多）
    private List<Address> addressList;

    /**
     * 获取关联的地址对象列表
     */
    public List<Address> getAddressList() {
        return addressList;
    }

    /**
     * 设置关联的地址对象列表
     */
    public void setAddressList(List<Address> addressList) {
        this.addressList = addressList;
    }

    /**
     * 无参构造方法
     */
    public SysUser() {
    }

    /**
     * 带参构造方法
     */
    public SysUser(String account, String realName, String password, int sex, String birthday, String phone, String address, long roleId, long createdUserId, String createdTime, long updatedUserId, String updatedTime) {
        this.account = account;
        this.realName = realName;
        this.password = password;
        this.sex = sex;
        this.birthday = birthday;
        this.phone = phone;
        this.address = address;
        this.roleId = roleId;
        this.createdUserId = createdUserId;
        this.createdTime = createdTime;
        this.updatedUserId = updatedUserId;
        this.updatedTime = updatedTime;
    }

    /**
     * 全参构造方法
     */
    public SysUser(long id, String account, String realName, String password, int sex, String birthday, String phone, String address, long roleId, long createdUserId, String createdTime, long updatedUserId, String updatedTime) {
        this.id = id;
        this.account = account;
        this.realName = realName;
        this.password = password;
        this.sex = sex;
        this.birthday = birthday;
        this.phone = phone;
        this.address = address;
        this.roleId = roleId;
        this.createdUserId = createdUserId;
        this.createdTime = createdTime;
        this.updatedUserId = updatedUserId;
        this.updatedTime = updatedTime;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public long getRoleId() {
        return roleId;
    }

    public void setRoleId(long roleId) {
        this.roleId = roleId;
    }

    public long getCreatedUserId() {
        return createdUserId;
    }

    public void setCreatedUserId(long createdUserId) {
        this.createdUserId = createdUserId;
    }

    public String getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(String createdTime) {
        this.createdTime = createdTime;
    }

    public long getUpdatedUserId() {
        return updatedUserId;
    }

    public void setUpdatedUserId(long updatedUserId) {
        this.updatedUserId = updatedUserId;
    }

    public String getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(String updatedTime) {
        this.updatedTime = updatedTime;
    }

    /**
     * toString方法
     */
    @Override
    public String toString() {
        StringBuilder strbuf = new StringBuilder();
        if (addressList != null && !addressList.isEmpty()) {
            for (Address addr : addressList) {
                strbuf.append("\n\t").append(addr.toString());
            }
        }
        return "SysUser{" +
                "id=" + id +
                ", account='" + account + '\'' +
                ", realName='" + realName + '\'' +
                ", password='" + password + '\'' +
                ", sex=" + sex +
                ", birthday='" + birthday + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                ", roleId=" + roleId +
                ", roleName='" + roleName + '\'' +
                ", createdUserId=" + createdUserId +
                ", createdTime='" + createdTime + '\'' +
                ", updatedUserId=" + updatedUserId +
                ", updatedTime='" + updatedTime + '\'' +
                ", sysRole=" + sysRole +
                ", addressList=[" + strbuf +
                "]" +
                "}";
    }

}
